﻿<UserControl x:Class="Atlanchim.Crm.Mui.Pages.Documents.PageEditDocument"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             xmlns:lmondeilConverters="clr-namespace:Atlanchim.Crm.Mui.Pages.Documents"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="20"/>
            <RowDefinition Height="20"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--Entête-->
        <TextBlock Text="Devis / Contrat" Style="{StaticResource Heading2}" />

        <!--Actions-->
        <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
            <mui:ModernButton Content="Enregistrer"
                          Command="{Binding Path=SaveCommand}" CommandParameter="{Binding}"
                          IconData="{DynamicResource LmondeilSaveButtonPath}" Foreground="{DynamicResource LmondeilSaveButtonColor}" />
            <mui:ModernButton Content="Annuler"
                              Margin="10,0,0,0"
                          Command="{Binding Path=CancelCommand}" CommandParameter="{Binding}"
                          IconData="{DynamicResource LmondeilCancelButtonPath}" Foreground="{DynamicResource LmondeilCancelButtonColor}" />
        </StackPanel>

        <!--informations sur l'email-->
        <Grid Grid.Row="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120"/>
                <ColumnDefinition Width="5"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="40"/>
                <RowDefinition Height="40"/>
                <RowDefinition Height="40"/>
                <RowDefinition Height="40"/>
                <RowDefinition Height="40"/>
                <RowDefinition Height="40"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>

            <Rectangle Fill="{DynamicResource ResourceKey=DocumentColor}" Grid.RowSpan="7"/>

            <TextBlock Text="Type" Grid.Row="0" Grid.Column="0"
                     VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,3,10,0" Style="{DynamicResource MandatoryTextBlock}" />
            <ComboBox Text="{Binding Document.Type, FallbackValue=[Type]}" Grid.Row="0" Grid.Column="2" 
                     VerticalAlignment="Top" IsEditable="True" >
                <ComboBoxItem Content="Devis" ToolTip="Devis"/>
                <ComboBoxItem Content="Contrat" ToolTip="Contrat"/>
            </ComboBox>

            <TextBlock Text="Code" Grid.Row="1" Grid.Column="0"
                     VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0" Style="{DynamicResource MandatoryTextBlock}" />
            <TextBox Text="{Binding Document.Code, FallbackValue=[Code]}" Grid.Row="1" Grid.Column="2" 
                     VerticalAlignment="Center"/>

            <TextBlock Text="Titre" Grid.Row="2" Grid.Column="0"
                     VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0" />
            <TextBox Text="{Binding Document.Titre, FallbackValue=[Titre]}" Grid.Row="2" Grid.Column="2" 
                     VerticalAlignment="Center"/>

            <TextBlock Text="Date de Création" Grid.Row="3" Grid.Column="0"
                     VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0" Style="{DynamicResource MandatoryTextBlock}" />
            <DatePicker SelectedDate="{Binding Document.DateCreation, FallbackValue=[DateCreation]}" SelectedDateFormat="Short" Grid.Row="3" Grid.Column="2" 
                     VerticalAlignment="Center" FontSize="16" Height="26" Margin="2"/>
            <!--<TextBox Text="{Binding Document.DateCreation, FallbackValue=[DateCreation]}" Grid.Row="3" Grid.Column="2" 
                     VerticalAlignment="Center"/>-->

            <TextBlock Text="Date de Retour" Grid.Row="4" Grid.Column="0"
                     VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0" />
            <DatePicker SelectedDate="{Binding Document.DateRetour, FallbackValue=[DateRetour]}" SelectedDateFormat="Short" Grid.Row="4" Grid.Column="2" 
                     VerticalAlignment="Center" FontSize="16" Height="26" Margin="2"/>
            <!--<TextBox Text="{Binding Document.DateRefus}" Grid.Row="4" Grid.Column="2" 
                     VerticalAlignment="Center"/>-->

            <TextBlock Text="Raison du Refus" Grid.Row="5" Grid.Column="0"
                     VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0" />
            <TextBox Text="{Binding Document.RaisonRefus, FallbackValue=[RaisonRefus]}" Grid.Row="5" Grid.Column="2" 
                     VerticalAlignment="Center"/>

            <TextBlock Text="Commentaire" Grid.Row="6" Grid.Column="0"
                     HorizontalAlignment="Right" Margin="0,0,10,0" />
            <TextBox Text="{Binding Document.Commentaire, FallbackValue=[Commentaire]}" Grid.Row="6" Grid.Column="2" 
                     AcceptsReturn="True"/>
        </Grid>

    </Grid>
</UserControl>
